package org.agile2soft.nexoma.tapestry.encoder;

import java.text.SimpleDateFormat;

import org.agile2soft.nexoma.controller.ExpedientController;
import org.agile2soft.nexoma.entity.Expedient;
import org.hibernate.SessionFactory;

import br.com.arsmachina.module.service.PrimaryKeyTypeService;
import br.com.arsmachina.tapestrycrud.hibernate.encoder.HibernateIntegerEncoder;

public class ExpedientEncoder extends HibernateIntegerEncoder<Expedient> {

    public ExpedientEncoder(SessionFactory sessionFactory,
            ExpedientController controller) {
        super(sessionFactory, controller);
    }
//    public ExpedientEncoder(SessionFactory sessionFactory,
//            ExpedientController controller,
//            PrimaryKeyTypeService primaryKeyTypeService) {
//        super(sessionFactory, controller,primaryKeyTypeService);
//    }

    public String toLabel(Expedient expedient) {
        SimpleDateFormat sdf = new SimpleDateFormat("YYYY/MM/DD");
        return expedient.getId() + sdf.format(expedient.getOpenDate());
    }

}
